﻿<Page x:Class="Halfwit.Views.TweetsPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
    xmlns:h="clr-namespace:Halfwit"
    xmlns:u="clr-namespace:Halfwit.Controls"
    xmlns:p="clr-namespace:Halfwit.Properties"
    xmlns:tw="clr-namespace:TweetSharp.Twitter.Model;assembly=TweetSharp.Twitter.ClientProfile"
    Title="{Binding Title}"
    x:Name="me">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary  Source="TweetsViewTemplates.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <CollectionViewSource x:Key="TweetsView" Source="{Binding Tweets}">
                <CollectionViewSource.SortDescriptions>
                    <scm:SortDescription PropertyName="CreatedDate" Direction="Descending" />
                </CollectionViewSource.SortDescriptions>
            </CollectionViewSource>

            <Style TargetType="ListBox">
                <Style.Resources>
                    <LinearGradientBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Opacity="0.6" StartPoint="0,0" EndPoint="0,1">
                        <GradientStop Color="LightSkyBlue" Offset="0.2" />
                        <GradientStop Color="SkyBlue" Offset="1" />
                    </LinearGradientBrush>
                    <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />

                    <LinearGradientBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Opacity="0.3" StartPoint="0,0" EndPoint="0,1">
                        <GradientStop Color="SkyBlue" Offset="0.2" />
                        <GradientStop Color="LightSkyBlue" Offset="1" />
                    </LinearGradientBrush>
                    <SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Black" />
                </Style.Resources>
            </Style>

            <Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource {x:Type ListBoxItem}}">
                <Setter Property="Background" Value="{StaticResource TweetBackground}" />
                <Setter Property="Padding" Value="0" />
                <!--<Setter Property="MaxWidth" Value="{Binding ActualWidth,RelativeSource={RelativeSource FindAncestor,AncestorType=ScrollContentPresenter},Converter={StaticResource TweetWidth}}" />-->
                <!--<Setter Property="VerticalContentAlignment" Value="Stretch"/>
                <Setter Property="HorizontalContentAlignment" Value="Stretch" />-->
                <!--<Setter Property="Width" Value="Auto" />-->

                <Style.Triggers>
                    <DataTrigger Binding="{Binding Converter={StaticResource IsMine}}" Value="True">
                        <Setter Property="Background" Value="{StaticResource MyTweetBackground}" />
                    </DataTrigger>

                    <DataTrigger Value="True">
                        <DataTrigger.Binding>
                            <MultiBinding Converter="{StaticResource IsMention}">
                                <Binding />
                                <Binding Path="ScreenName" Source="{x:Static h:TwitterConnection.User}" StringFormat="@{0}" />
                            </MultiBinding>
                        </DataTrigger.Binding>

                        <Setter Property="Background" Value="{StaticResource MentionBackground}" />
                    </DataTrigger>

                    <DataTrigger Binding="{Binding Source}" Value="{x:Static h:HalfwitConstants.DirectMessageSource}">
                        <Setter Property="Background" Value="{StaticResource MessageBackground}" />
                    </DataTrigger>

                    <DataTrigger Binding="{Binding Source}" Value="{x:Static h:HalfwitConstants.SearchResultSource}">
                        <Setter Property="Background" Value="{StaticResource SearchBackground}" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="EmoticonContextMenu" TargetType="{x:Type ContextMenu}">
                <Setter Property="SnapsToDevicePixels" Value="True"/>
                <Setter Property="OverridesDefaultStyle" Value="True"/>
                <Setter Property="Grid.IsSharedSizeScope" Value="true"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ContextMenu}">
                            <Border 
                                 Name="Border"
                                 BorderBrush="DarkGray"
                                 BorderThickness="1"
                                 Background="White" >
                                <WrapPanel Orientation="Horizontal" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle"/>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="EmoticonItem" TargetType="{x:Type MenuItem}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type MenuItem}">
                            <MenuItem 
                                Width="24" 
                                MaxWidth="24" 
                                Height="24"
                                RenderOptions.BitmapScalingMode="NearestNeighbor"
                                CommandParameter="{Binding Key}"   
                                ToolTip="{Binding Value}"                                      
                                Command="{Binding DataContext.InsertText,RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}"
                                >
                                <MenuItem.Icon>
                                    <TextBlock Text="{Binding Key}" 
                                              HorizontalAlignment="Center"
                                              FontSize="14"/>
                                </MenuItem.Icon>
                            </MenuItem>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <DataTemplate DataType="{x:Type tw:TwitterStatus}">
                <Border
                    Width="{Binding ActualWidth,RelativeSource={RelativeSource FindAncestor,AncestorType=ScrollContentPresenter}}" 
                    Background="Transparent"
                    BorderBrush="LightGray"
                    BorderThickness="0 0 0 1"
                    SnapsToDevicePixels="True"
                    >
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <Border
                            Grid.Column="0"
                            Grid.Row="0"
                            BorderBrush="DarkGray"
                            BorderThickness="1" 
                            Background="White"
                            Height="50"
                            Width="50"
                            Margin="4"
                            Padding="0"
                            VerticalAlignment="Top"
                            HorizontalAlignment="Left"
                            >
                            <Image Source="{Binding User.ProfileImageUrl}" />
                        </Border>

                        <Border 
                            Grid.Column="0" 
                            Grid.Row="0"
                            BorderBrush="DarkGray" 
                            BorderThickness="1" 
                            Height="24" 
                            Width="24"
                            Background="White"
                            VerticalAlignment="Top"
                            HorizontalAlignment="Left" 
                            IsHitTestVisible="False"
                            >
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding RetweetedStatus}" Value="{x:Null}">
                                            <Setter Property="Visibility" Value="Collapsed" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>

                            <Border.RenderTransform>
                                <TransformGroup>
                                    <RotateTransform Angle="15" CenterX="0" CenterY="0" />
                                    <TranslateTransform X="34" Y="32" />
                                </TransformGroup>
                            </Border.RenderTransform>

                            <Image Source="{Binding RetweetedStatus.User.ProfileImageUrl}" />
                            <!--<Image.Source>
                                    <BitmapImage DecodePixelHeight="24" DecodePixelWidth="24" UriSource="{Binding RetweetedStatus.User.ProfileImageUrl}" />
                                </Image.Source>
                            </Image>-->
                            <!--Source="{Binding RetweetedStatus.User.ProfileImageUrl}" />-->
                        </Border>

                        <StackPanel Grid.Column="1" Grid.Row="0" Margin="4,2,4,8">
                            <DockPanel>
                                <Image 
                                    DockPanel.Dock="Right" 
                                    Height="16" 
                                    Width="16" 
                                    Source="/Images/star.png"
                                    Visibility="{Binding IsFavorited,Converter={StaticResource b2v}}"
                                    />

                                <TextBlock FontSize="{Binding FontScale,Source={x:Static p:Settings.Default},Converter={StaticResource FontScale},ConverterParameter=16}" FontWeight="Bold">
                                    <Hyperlink
                                        Command="{Binding DataContext.NavigateToUser,ElementName=me}" 
                                        CommandParameter="{Binding User.ScreenName}"
                                        Foreground="Black"
                                        TextDecorations="None"
                                        >
                                        <Hyperlink.ToolTip>
                                            <ToolTip Content="{Binding User.ScreenName}" ContentStringFormat="View tweets by {0} (Ctrl+U)" />
                                        </Hyperlink.ToolTip>
                                        
                                        <TextBlock Text="{Binding User.ScreenName}"/>
                                    </Hyperlink>
                                </TextBlock>
                            </DockPanel>

                            <ContentControl 
                                Focusable="False"
                                TextBlock.FontSize="{Binding FontScale,Source={x:Static p:Settings.Default},Converter={StaticResource FontScale},ConverterParameter=13}" 
                                Margin="0,0,0,4"
                                Content="{Binding Converter={StaticResource TwitterText}}" />

                            <StackPanel 
                                Orientation="Horizontal" 
                                TextBlock.FontSize="{Binding FontScale,Source={x:Static p:Settings.Default},Converter={StaticResource FontScale},ConverterParameter=11}"
                                TextBlock.Foreground="Gray"
                                >
                                <StackPanel.Resources>
                                    <Style TargetType="Hyperlink" BasedOn="{StaticResource {x:Type Hyperlink}}">
                                        <Setter Property="Foreground" Value="Teal" />
                                    </Style>
                                </StackPanel.Resources>

                                <TextBlock>
                                    <Hyperlink
                                        Command="{Binding DataContext.NavigateToUrl,ElementName=me}" 
                                        CommandParameter="{Binding Converter={StaticResource TwitterStatusUri}}"
                                        TextDecorations="None" 
                                        ToolTip="Visit this tweet in a browser"
                                        >
                                        <TextBlock Text="{Binding CreatedDate,Converter={StaticResource TwitterDateTime}}" />
                                    </Hyperlink>
                                </TextBlock>
                                
                                <ContentControl 
                                    Focusable="False"
                                    Content="{Binding Source,Converter={StaticResource StatusSource}}" />

                                <TextBlock>
                                    <Hyperlink
                                        Command="{Binding DataContext.FindSource,ElementName=me}" 
                                        CommandParameter="{Binding}" 
                                        TextDecorations="None" 
                                        ToolTip="Locate the tweet that this is a reply to (Backspace)"
                                        >
                                        <TextBlock Text="{Binding InReplyToScreenName,StringFormat=' in reply to {0}'}" />
                                    </Hyperlink>

                                    <TextBlock.Style>
                                        <Style TargetType="TextBlock">
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding InReplyToScreenName}" Value="{x:Null}">
                                                    <Setter Property="Visibility" Value="Collapsed" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </TextBlock.Style>
                                </TextBlock>

                                <TextBlock>
                                    <Hyperlink
                                        Command="{Binding DataContext.FindSource,ElementName=me}" 
                                        CommandParameter="{Binding}" 
                                        TextDecorations="None" 
                                        ToolTip="Locate the original tweet (Backspace)"
                                        >
                                        <TextBlock Text="{Binding RetweetedStatus.User.ScreenName,StringFormat=' retweeting {0}'}" />
                                    </Hyperlink>

                                    <TextBlock.Style>
                                        <Style TargetType="TextBlock">
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding RetweetedStatus}" Value="{x:Null}">
                                                    <Setter Property="Visibility" Value="Collapsed" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </TextBlock.Style>
                                </TextBlock>
                            </StackPanel>
                        </StackPanel>

                        <StackPanel 
                            Grid.ColumnSpan="2"
                            Grid.Row="1"
                            HorizontalAlignment="Right" 
                            Orientation="Horizontal" 
                            Margin="4,-4,4,4">

                            <!-- mini-toolbar -->
                            <StackPanel.Style>
                                <Style TargetType="StackPanel">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding IsSelected,RelativeSource={RelativeSource FindAncestor,AncestorType=ListBoxItem}}" Value="True">
                                            <Setter Property="Visibility" Value="Visible" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </StackPanel.Style>
                            <StackPanel.Resources>
                                <Style TargetType="Button" BasedOn="{StaticResource FlatButtonStyle}" />

                                <Style TargetType="Image">
                                    <Setter Property="Width" Value="16" />
                                    <Setter Property="Height" Value="16" />
                                    <Setter Property="RenderOptions.BitmapScalingMode" Value="NearestNeighbor" />
                                </Style>
                            </StackPanel.Resources>

                            <Button 
                                    Command="{Binding DataContext.Copy,ElementName=me}" 
                                    CommandParameter="{Binding}" 
                                    ToolTip="Copy (Ctrl+C)"
                                    >
                                <Image Source="/Images/copy.png" />
                            </Button>
                            <Button 
                                    Command="{Binding DataContext.Reply,ElementName=me}" 
                                    CommandParameter="{Binding}" 
                                    ToolTip="Reply (Ctrl+R) (Hold Shift to Reply to All)"
                                    >
                                <Image Source="/Images/write.png" />
                            </Button>
                            <Button 
                                    Command="{Binding DataContext.Retweet,ElementName=me}" 
                                    CommandParameter="{Binding}" 
                                    ToolTip="Retweet (Ctrl+T)"
                                    >
                                <Image Source="/Images/retweet.png" />
                            </Button>
                            <Button 
                                    Command="{Binding DataContext.Favourite,ElementName=me}" 
                                    CommandParameter="{Binding}" 
                                    ToolTip="Toggle Favourite (Ctrl+F)"
                                    >
                                <Image Source="/Images/star.png" />
                            </Button>
                            <Line X1="0" Y1="4" X2="0" Y2="23" Margin="2,0" StrokeThickness="1" Stroke="SkyBlue" SnapsToDevicePixels="True" />
                            <Button 
                                    Command="{Binding DataContext.Delete,ElementName=me}" 
                                    CommandParameter="{Binding}" 
                                    >
                                <Button.ToolTip>
                                    <ToolTip Content="{Binding PlacementTarget.Command.Text,RelativeSource={RelativeSource Self}}" ContentStringFormat="{}{0} (Ctrl+Del)" />
                                </Button.ToolTip>
                                <Image Source="/Images/delete.png" />
                            </Button>
                            <Line X1="0" Y1="4" X2="0" Y2="23" Margin="2,0" StrokeThickness="1" Stroke="SkyBlue" SnapsToDevicePixels="True" />
                            <Button 
                                    Command="{Binding DataContext.Follow,ElementName=me}" 
                                    CommandParameter="{Binding User}" 
                                    ToolTip="{Binding User,Converter={StaticResource FollowText}}"
                                    >
                                <Image Source="/Images/user.png" />
                            </Button>
                            <Button 
                                    Command="{Binding DataContext.DirectMessage,ElementName=me}" 
                                    CommandParameter="{Binding User}" 
                                    ToolTip="{Binding User,Converter={StaticResource MessageText}}"
                                    >
                                <Image Source="/Images/messages.png" />
                            </Button>
                        </StackPanel>
                    </Grid>
                </Border>
            </DataTemplate>
        </ResourceDictionary>

    </Page.Resources>

    <DockPanel>
        <DockPanel DockPanel.Dock="Top" Margin="2">
            <DockPanel.Resources>
                <Style TargetType="Button" BasedOn="{StaticResource FlatButtonStyle}" />

                <Style TargetType="ToggleButton" BasedOn="{StaticResource FlatToggleButtonStyle}">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding IsChecked,RelativeSource={RelativeSource Self}}" Value="True">
                            <Setter Property="BorderBrush" Value="DarkGray" />
                            <Setter Property="Background">
                                <Setter.Value>
                                    <LinearGradientBrush 
                                            StartPoint="0,0" 
                                            EndPoint="0,1"
                                            >
                                        <GradientStop Color="SkyBlue" Offset="0" />
                                        <GradientStop Color="Azure" Offset="1" />
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>

                <Style TargetType="u:DropDownButton" BasedOn="{StaticResource {x:Type ToggleButton}}" />

                <Style TargetType="Image">
                    <Setter Property="Width" Value="16" />
                    <Setter Property="Height" Value="16" />
                    <Setter Property="RenderOptions.BitmapScalingMode" Value="NearestNeighbor" />
                </Style>
            </DockPanel.Resources>

            <ToggleButton 
                x:Name="writeButton" 
                DockPanel.Dock="Right" 
                IsChecked="{Binding IsUpdating}" 
                VerticalAlignment="Top"
                ToolTip="Update your status (Ctrl+W)"
                >
                <Image Source="/Images/write.png"/>
            </ToggleButton>

            <u:DropDownButton
                DockPanel.Dock="Right"
                Focusable="False" 
                VerticalAlignment="Bottom"
                ToolTip="Tools">

                <u:DropDownButton.DropDown>
                    <ContextMenu>
                        <MenuItem 
                            Command="{Binding Connection}"
                            Header="_Connection"
                            />
                        <Separator />
                        <MenuItem 
                            Command="{Binding Options}"
                            Header="_Options"
                            />
                        <Separator />
                        <MenuItem
                            Command="{Binding About}"
                            Header="_About Halfwit"
                            />
                    </ContextMenu>
                </u:DropDownButton.DropDown>

                <Image Source="/Images/tools.png" />
            </u:DropDownButton>

            <StackPanel Orientation="Horizontal">
                <Button Command="{Binding NavigateToHome}" ToolTip="Home (Ctrl+1)">
                    <Image Source="/Images/home.png" />
                </Button>
                <Button Command="{Binding NavigateToMentions}" ToolTip="Mentions (Ctrl+2)">
                    <Image Source="/Images/mentions.png" />
                </Button>
                <Button Command="{Binding NavigateToMessages}" ToolTip="Direct Messages (Ctrl+3)">
                    <Image Source="/Images/messages.png" />
                </Button>
                <Button Command="{Binding NavigateToUser}" ToolTip="User (Ctrl+4)">
                    <Image Source="/Images/user.png" />
                </Button>
                <Button Command="{Binding NavigateToSearch}" ToolTip="Search (Ctrl+5)">
                    <Image Source="/Images/search.png" />
                </Button>
                <Button Command="{Binding NavigateToUrl}" CommandParameter="{Binding Uri}" ToolTip="Open Twitter with this view (Ctrl+6)">
                    <Image Source="/Images/web.png" />
                </Button>

                <Line X1="0" Y1="4" X2="0" Y2="23" Margin="2,0" Stroke="SkyBlue" SnapsToDevicePixels="True" />

                <Button Command="{Binding Refresh}" ToolTip="Refresh (F5)">
                    <Image Source="/Images/refresh.png" />
                </Button>
            </StackPanel>
        </DockPanel>

        <StackPanel
            DockPanel.Dock="Top"
            Margin="8"
            Visibility="{Binding IsChecked,Converter={StaticResource b2v},ElementName=writeButton}"
            >
            <TextBox 
                x:Name="updateText" 
                h:UsernameLookup.Trigger="AtSign"
                FontSize="{Binding FontScale,Source={x:Static p:Settings.Default},Converter={StaticResource FontScale},ConverterParameter=13}" 
                Height="60" 
                MaxLength="320" 
                TextWrapping="Wrap" 
                Text="{Binding UpdateText,UpdateSourceTrigger=PropertyChanged}"
                SpellCheck.IsEnabled="True"
                SelectionChanged="updateText_SelectionChanged"
                />
            <ProgressBar
                Minimum="0"
                Maximum="140"
                Value="{Binding UpdateLength,Mode=OneWay}"
                Height="6"
                Margin="0"
                Padding="0"
                BorderThickness="0"
                Background="Transparent"
                >
                <ProgressBar.ToolTip>
                    <ToolTip Content="{Binding UpdateLength}" ContentStringFormat="{}{0} of 140 characters"/>
                </ProgressBar.ToolTip>

                <ProgressBar.Style>
                    <Style TargetType="ProgressBar">
                        <Setter Property="Foreground" Value="DeepSkyBlue"/>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsUpdateTextValid}" Value="False">
                                <Setter Property="Foreground" Value="Red" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </ProgressBar.Style>
            </ProgressBar>

            <DockPanel>
                <Button Style="{StaticResource {x:Type ButtonBase}}"
                    DockPanel.Dock="Right"
                    Command="{Binding Tweet}"  Width="65"
                    Margin="0 4 0 0">Update</Button>

                <u:DropDownButton
                    DockPanel.Dock="Right"
                    Focusable="False"
                    IsEnabled="{Binding UpdateTextContainsUrl}"
                    VerticalAlignment="Bottom"
                    ToolTip="Shorten URLs"
                    Margin="0 0 5 0"
                    Style="{StaticResource {x:Type ButtonBase}}"
                    >
                    <u:DropDownButton.DropDown>
                        <ContextMenu ItemsSource="{Binding ShortenUrlMenuItems}" />
                    </u:DropDownButton.DropDown>
                    <Image 
                        Source="/Images/link.png" 
                        Height="16"
                        Width="16"
                        RenderOptions.BitmapScalingMode="HighQuality"
                        />
                </u:DropDownButton>

                <u:DropDownButton
                    DockPanel.Dock="Right"
                    Focusable="False" 
                    VerticalAlignment="Bottom"
                    ToolTip="Emoticons"
                    Margin="0 0 5 0"
                    Style="{StaticResource {x:Type ButtonBase}}">
                    <u:DropDownButton.DropDown>
                        <ContextMenu Width="98"
                            ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                            Style="{StaticResource EmoticonContextMenu}"
                            ItemContainerStyle="{StaticResource EmoticonItem}"
                            ItemsSource="{Binding Source={x:Static h:HalfwitConstants.Emoticons}}"
                            />
                    </u:DropDownButton.DropDown>
                    <TextBlock Text="☺" FontSize="14" />
                </u:DropDownButton>

                <TextBlock 
                    VerticalAlignment="Center"
                    Text="{Binding UpdateContext.Message}">
                    <TextBlock.Style>
                        <Style TargetType="TextBlock">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding UpdateContext}" Value="{x:Null}">
                                    <Setter Property="Visibility" Value="Hidden" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </TextBlock.Style>
                </TextBlock>
            </DockPanel>
        </StackPanel>

        <!-- Displays the current viewmodel, using the template defined in TweetsViewTemplates.xaml -->
        <ContentControl Focusable="False" DockPanel.Dock="Top" Content="{Binding}" />

        <StatusBar DockPanel.Dock="Bottom" Padding="0,0,16,0" Background="Transparent">
            <StatusBarItem DockPanel.Dock="Right" ToolTip="API calls remaining this hour" Content="{Binding RateLimitStatus.RemainingHits}" />

            <Separator DockPanel.Dock="Right"
                       Width="2" 
                       SnapsToDevicePixels="True" 
                       Background="{x:Static SystemColors.ControlLightBrush}"/>

            <StatusBarItem>
                <TextBlock TextTrimming="CharacterEllipsis" Text="{Binding Status}" />
            </StatusBarItem>
        </StatusBar>

        <ListBox 
            x:Name="tweetList"
            HorizontalContentAlignment="Stretch"
            ItemsSource="{Binding Source={StaticResource TweetsView}}" 
            ScrollViewer.HorizontalScrollBarVisibility="Disabled"
            SelectedItem="{Binding SelectedItem,Mode=TwoWay}"
            />
        <!--<ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel Orientation="Horizontal" IsItemsHost="True" />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
        </ListBox>-->
    </DockPanel>
</Page>
